<?php
 class Application_Model_Auth_Uzytkownicy extends Zend_Db_Table_Abstract {
    protected $_name = 'user';
    
     public function addUser($login,$haslo,$plec,$email)
     {
         $data = array(
             'login' => $login,
             'password' => $haslo,
             'gender' => $plec,
             'email' => $email,
             'idacctype' => '2',
         );
         $this->insert($data);
     }
     
     
     public function editUser($id,$email,$haslo,$plec)
     {
         $data = array(
             'password' => $haslo,
             'gender' => $plec,
             'email' => $email,
         );
         $this->update($data, 'iduser = '. (int)$id);
     }
     
     public function admineditUser($id,$login,$email,$plec,$rola)
     {
         $data = array(
             'login' => $login,
             'gender' => $plec,
             'email' => $email,
             'idacctype' => $rola
         );
         $this->update($data, 'iduser = '. (int)$id);
     }
     
      public function deleteUser($id)
     {
         $this->delete('iduser =' . (int)$id);
     }
 
          
      public function getUser($id)
     {
 
         $id = (int)$id;
         $row = $this->fetchRow('iduser = ' . $id);
         if (!$row) {
             throw new Exception("Brak $id");
         }
         return $row->toArray();
     }
     
 }
 ?>